//要么暴力，要么借助hash
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
struct ListNode* removeDuplicateNodes(struct ListNode* head) {
    if(head == NULL)
        return head;
    struct ListNode *slow = head, *fast = slow;
    while(slow){
        fast = slow;
        while(fast->next){
            if(fast->next->val == slow->val){
                struct ListNode* cur = fast->next;
                fast->next = fast->next->next;
                free(cur);
            }else{
                fast = fast->next;
            }
        }
        slow = slow->next;
    }
    return head;
}

/*编写代码，移除未排序链表中的重复节点。保留最开始出现的节点。*/